<?php

use Phinx\Migration\AbstractMigration;
use McDanci\ThinkPHP\Phinx;

class User extends AbstractMigration
{
    public function change()
    {
        $this
            ->table(
                (new \Jawira\CaseConverter\Convert(mb_strcut(__CLASS__, mb_strlen(__NAMESPACE__) + 1)))
                    ->toSnake(), [
                    Phinx::TABLE_COLLATION => Phinx::TABLE_COLLATION_U8MG,
                    Phinx::SIGNED => false,
                ]
            )
            ->addColumn('name', Phinx::COL_TYP_STRING, [
                Phinx::COL_OPT_LIMIT => 255,
                Phinx::COL_OPT_NULL => false,
            ])
            ->addColumn('passwd', Phinx::COL_TYP_STRING, [
                Phinx::COL_OPT_LIMIT => 255,
                Phinx::COL_OPT_NULL => false,
            ])
            ->create();
    }
}
